/**
 * loading 图标
 */
import 'package:flutter_benchu/utils/commonPkg.dart';
import 'package:flutter_spinkit/flutter_spinkit.dart';

class Loading extends StatelessWidget {

  final double size;
  final Color color;
  final String type;

  const Loading({
    Key key,
    this.size = 50,
    this.color = Colors.white,
    this.type = 'Circle',
  }) : super(key: key);

  Widget getLoadingIcon() {
    if(type=='Circle') return SpinKitCircle( size: size, color: Colors.white);
    if(type=='FadingCircle') return SpinKitFadingCircle( size: size, color: Colors.white);
    if(type=='CubeGrid') return SpinKitCubeGrid( size: size, color: Colors.white);
    if(type=='ThreeBounce') return SpinKitThreeBounce( size: size, color: Colors.white);
    return SpinKitCircle( size: size, color: Colors.white);
  }

  @override
  Widget build(BuildContext context) {
    return Container(child: Center(child: getLoadingIcon()));
  }
}
